/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.urca.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Lucas
 */
@Embeddable
public class BiAutoresMateriaisPK implements Serializable {
    
	private static final long serialVersionUID = 1L;

	@Column(name = "COD_TIPO_MATERIAL")    
	private Character codTipoMaterial;
    
    @Column(name = "COD_NUMERO_MATERIAL")    
    private int codNumeroMaterial;
	
    @Column(name = "COD_ITEM")
    private short codItem;

    public BiAutoresMateriaisPK() {
    }

    public BiAutoresMateriaisPK(Character codTipoMaterial, int codNumeroMaterial, short codItem) {
        this.codTipoMaterial = codTipoMaterial;
        this.codNumeroMaterial = codNumeroMaterial;
        this.codItem = codItem;
    }

    public Character getCodTipoMaterial() {
        return codTipoMaterial;
    }

    public void setCodTipoMaterial(Character codTipoMaterial) {
        this.codTipoMaterial = codTipoMaterial;
    }

    public int getCodNumeroMaterial() {
        return codNumeroMaterial;
    }

    public void setCodNumeroMaterial(int codNumeroMaterial) {
        this.codNumeroMaterial = codNumeroMaterial;
    }

    public short getCodItem() {
        return codItem;
    }

    public void setCodItem(short codItem) {
        this.codItem = codItem;
    }

    @Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + codItem;
		result = prime * result + codNumeroMaterial;
		result = prime * result
				+ ((codTipoMaterial == null) ? 0 : codTipoMaterial.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BiAutoresMateriaisPK other = (BiAutoresMateriaisPK) obj;
		if (codItem != other.codItem)
			return false;
		if (codNumeroMaterial != other.codNumeroMaterial)
			return false;
		if (codTipoMaterial == null) {
			if (other.codTipoMaterial != null)
				return false;
		} else if (!codTipoMaterial.equals(other.codTipoMaterial))
			return false;
		return true;
	}

	@Override
    public String toString() {
        return "model.BiAutoresMateriaisPK[ codTipoMaterial=" + codTipoMaterial + ", codNumeroMaterial=" + codNumeroMaterial + ", codItem=" + codItem + " ]";
    }
    
}
